package com.kaifamiao.handle;

import java.util.Scanner;

public class HandleTest4 {

	public static void main(String[] args) {
		
		final Scanner s = new Scanner( System.in );
		
		int n = 0 ;
		
		do {
			try {
				System.out.println( "请输入[1,10]之间的任意整数" );
				n = s.nextInt();
			} catch( Exception e ) {
				System.out.println( "您的输入不正确，请重新输入" );
				n = 0 ; // 这里通过 n 来保证可以继续执行下次循环操作
			} finally {
				s.nextLine(); // 将未读取的回车和换行符读完
			}
		}while( n <= 0 || n > 10 );
		
		System.out.println( "您输入的是: " + n );
		
		s.close();
		
	}

}
